#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__author__ = "Administrator"
__name__="linux"
__date__="2016/8/12"
__time__="15:11"
"""
# 定义监控Linux服务器的监控项
import generic
from data_process import avg,hit,last

class cpu(generic.BaseService):
    def __init__(self):
        super(cpu,self).__init__()  # 继承父类的构造函数,子类默认就有了(name,interval,last_time,plugin_name,triggers这些字段)
        self.name = 'linux_cpu' # 重写父类的字段
        self.interval = 30
        self.plugin_name = 'check_cpu'
        self.triggers = {
            'idel':{
                'func':avg,
                'minutes':15,
                'operator':'lt',
                'warning':20,
                'caitical':5,
                'data_type':'percentage'
            },
            'iowait':{
                'func':hit,
                'minutes':10,
                'operator':'gt',
                'warning':80,
                'caitical':90,
                'data_type':'percentage'

            }
        }

class memory(generic.BaseService):
    def __init__(self):
        super(memory,self).__init__()
        # 如果这里不自定义数值，则采用父类的默认值。
#c1 =cpu()
#print c1.name
#print c1.triggers